package com.jg.service.impl;

import com.jg.dto.StuParam;
import com.jg.entity.Student;
import com.jg.mapper.StudentMapper;
import com.jg.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 86130
 * @version 1.0
 * @description: TODO
 * @date 2025/6/22 下午3:14
 */
@Service
public class StudentServiceImpl implements StudentService {
    @Autowired
    private StudentMapper studentMapper;

    @Override
    public List<Student> getList(StuParam stuParam) {
        return studentMapper.findAll(stuParam);
    }

    @Override
    public String delete(Integer studentId) {
        return studentMapper.delete(studentId) > 0 ? "success" : "fail";
    }

    @Override
    public String add(Student student) {
        return studentMapper.add(student) > 0 ? "success" : "fail";
    }

    @Override
    public Student findById(Integer studentId) {
        return studentMapper.findById(studentId);
    }

    @Override
    public String update(Student student) {
        return studentMapper.update(student) > 0 ? "success" : "fail";
    }
}
